import { UserInterface } from '@renderer/types'
import { acceptHMRUpdate, defineStore } from 'pinia'

interface userStoreInterface {
  userList: UserInterface[]
}

export const useFriendListStore = defineStore('friend', {
  state: (): userStoreInterface => {
    return {
      userList: []
    }
  },
  getters: {
    getUserList: (state) => state.userList
  },
  actions: {
    setUserList(list: UserInterface[]) {
      this.userList = list
    },
    setUserListItem(value: UserInterface) {
      this.userList.push(value)
    }
  }
})

if (import.meta.hot) {
  import.meta.hot.accept(acceptHMRUpdate(useFriendListStore, import.meta.hot))
}
